package zhoufu.sz.sanxiao_check.inject.components;


import android.support.annotation.NonNull;
import dagger.Component;
import javax.inject.Singleton;
import zhoufu.sz.sanxiao_check.inject.modules.AppModule;
import zhoufu.sz.sanxiao_check.services.DownloadService;
import zhoufu.sz.sanxiao_check.ui.BaseActivity;

/**
 * Created by hyc on 16/5/5.
 * 作为全局Component,唯一,为所有的Activity提供注入
 */
@Singleton
@Component(modules = { AppModule.class })
public interface AppComponent
{
    void inject(BaseActivity activity);

    void inject(DownloadService service);

    class Instance
    {
        private static AppComponent _appComponent;

        public static void init(@NonNull AppComponent component)
        {
            _appComponent = component;
        }

        public static AppComponent get()
        {
            return _appComponent;
        }
    }
}
